From: Daniel van Vugt Date: Thu, 24 Jun 2021 10:19:09 +0000 (+0800) Subject: st/private: Set sampling_radius to match the blur radius X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~239 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=48d5740443598193b67bfec48d0bb1a32e003572;p=gnome-shell.git st/private: Set sampling_radius to match the blur radius From [the spec](https://www.w3.org/TR/css-backgrounds-3/#shadow-blur): > the resulting shadow must approximate (with each pixel being within 5% > of its expected value) the image that would be generated by applying to > the shadow a Gaussian blur with a standard deviation [sigma] equal to > half the blur radius This does not change the value of `sigma`, it only corrects the value of `sampling_radius` used to size the shadow texture. Since the texture is no longer being slightly oversized it won't get scaled down when rendered according to the dimensions provided by `st_shadow_get_box` in `_st_paint_shadow_with_opacity`. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4409 Part-of: --- diff --git a/src/st/st-private.c b/src/st/st-private.c index 5bbefa763..540bad425 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -400,8 +400,9 @@ _st_create_shadow_pipeline (StShadow *shadow_spec, g_return_val_if_fail (shadow_spec != NULL, NULL); g_return_val_if_fail (src_texture != NULL, NULL); - sigma = resource_scale * shadow_spec->blur / 2.f; - sampling_radius = ceilf (1.5 * sigma) * 2.0; + sampling_radius = resource_scale * shadow_spec->blur; + sigma = sampling_radius / 2.f; + sampling_radius = ceilf (sampling_radius); src_width = cogl_texture_get_width (src_texture); src_height = cogl_texture_get_height (src_texture);